Bandit Write-up Level 3

Posted by CLoveYC on April 3, 2024

Goal:

Using command to get the password which is stored in a file called 'spaces in this filename'.

Login command: ssh bandit2@bandit.labs.overthewire.org -p 2220

Password: rRGizSaX8Mk1RTb1CNQoXTcYZWU6lgzi

My Solution:

This level is similar to the previous one. However, in this case, the challenge involves dealing with spaces in filenames. When typing a command like 'cat spaces in this filename', the system will interpret it as four separate files. Therefore, there must be a way to let the system know that the space is part of the filename. As soon as the problem arose, the escape character immediately came to mind. Consequently, I tried 'cat spaces\ in\ this\ filename', and the system provided me with the key. However, I began to wonder if there was another solution. After some thought, I realized that I could use double quotation marks. By enclosing the filename in double quotation marks, the system theoretically considers "spaces in this filename" as a single file, which can help solve this problem. Therefore, I tried it and successfully obtained the key. In my opinion, both solutions are excellent. Although having spaces in filenames might not be ideal, when faced with such files, both of these methods can efficiently help.

The Key

aBZ0W5EmUfAf7kHTQeOwd8bauFJ2lAiG